<include file="public@header" />
<link rel="stylesheet" href="__TMPL__/public/assets/css/animation.css">

<style>
.table img{
    width:50px;
}
.layui-table[lay-size=lg] td, .layui-table[lay-size=lg] th{
    padding: 10px 10px;
}
</style>
</head>
<body>
	<div class="layui-fluid">
        <div class="layui-row">

            <div class="layui-page-header">
                <div class="layui-card">
                    <div class="layui-page-header-content">
                        <div class="layui-card-body">
                            <div class="layui-ui-page-header-title" >
                                <if condition="input('sort') == 0">
                                付费内容<span class="layui-badge-rim page-content">付费内容信息</span>
                                <elseif condition="input('sort') == 2"/>
                                语音大班课<span class="layui-badge-rim page-content">语音大班课</span>
                                <elseif condition="input('sort') == 3"/>
                                视频大班课<span class="layui-badge-rim page-content">视频大班课</span>
                                    <else/></if>
                            </div>
                        </div>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title layui-nav" id="tabHeader">
                                <li class="layui-this layui-nav-item"><a href="{:url('course/index',['sort'=>$sort])}">列表</a></li>
<!--                                <li><a href="javascript:admin.openIframeLayer('{:url('course/add',['sort'=>$sort])}','{:lang('ADMIN_USER_ADD')}',{btn: ['保存','关闭'],area:['640px','50%'],end:function(){location.reload();}});">{:lang('ADD')}</a></li>-->
                                <li class="layui-nav-item"><a href="{:url('course/add',['sort'=>$sort])}">{:lang('ADD')}</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-page-content">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form" method="post" action="{:url('course/index',['sort'=>$sort])}">
                            <div class="layui-form-item layuiadmin-card-text" style="margin-bottom: 0;">
                                <div class="layui-inline">
                                    <label class="layui-form-label">上架状态</label>
                                    <div class="layui-input-inline">
                                        <select class="layui-input" name="status">
                                            <option value="">全部</option>
                                            <volist name="status" id="v">
                                            <option value="{$key}" <if condition="input('request.status') neq '' && input('request.status') eq $key">selected</if>>{$v}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">年级</label>
                                    <div class="layui-input-inline">
                                        <select class="form-control" name="gradeid">
                                            <option value="">全部</option>
                                            <volist name="grade" id="v">
                                                <option value="{$v['id']}" <if condition="input('request.gradeid') neq '' && input('request.gradeid') eq $v['id']">selected</if>>{$v['name']}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">获取方式</label>
                                    <div class="layui-input-inline">
                                        <select class="form-control" name="paytype">
                                            <option value="">全部</option>
                                            <volist name="paytypes" id="v">
                                                <option value="{$key}" <if condition="input('request.paytype') neq '' && input('request.paytype') eq $key">selected</if>>{$v}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <if condition="$sort neq 1 && $sort neq 3">
                                <div class="layui-inline">
                                    <label class="layui-form-label">内容形式</label>
                                    <div class="layui-input-inline">
                                        <select class="form-control" name="type">
                                            <option value="">全部</option>
                                            <volist name="types" id="v">
                                                <option value="{$key}" <if condition="input('request.type') neq '' && input('request.type') eq $key">selected</if>>{$v}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                </if>
                                <div class="layui-inline">
                                    <label class="layui-form-label">发布时间</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input js-bootstrap-date" name="start_time"
                                               value="{:input('request.start_time')}"
                                               autocomplete="off" placeholder="开始日期">
                                    </div>
                                    <div class="layui-form-mid">-</div>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input js-bootstrap-date" name="end_time"
                                               value="{:input('request.end_time')}"
                                               autocomplete="off" placeholder="结束日期">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">用户ID</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="uid" value="{:input('request.uid')}" placeholder="请输入用户ID">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">关键字</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="keyword" value="{:input('request.keyword')}" placeholder="请输入关键字">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input type="submit" class="layui-btn btn-primary" value="搜索" />
                                        <a class="layui-btn layui-btn-danger btn-danger" href="{:url('course/index',['sort'=>$sort])}">清空</a>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

            <div class="layui-page-content">
                <div class="layui-card">
                    <form method="post" class="layui-card-body js-ajax-form" action="{:url('course/listOrder')}">
                        <button class="layui-btn js-ajax-submit" type="submit">{:lang('SORT')}</button>
                        <table class="layui-table treeTable" id="menus-table" lay-even lay-skin="nob" lay-size="lg">
                            <thead>
                            <tr>

                                <th>{:lang('SORT')}</th>
                                <th>ID</th>
                                <th>讲师</th>
                                <th>学级</th>
                                <th>科目</th>
                                <if condition="$sort neq 1 && $sort neq 3">
                                    <th>内容形式</th>
                                </if>
                                <th>标题</th>
                                <th>封面</th>
                                <th>获取</th>
                                <if condition="$sort eq 1">
                                    <th>课时数</th>
                                </if>
                                <th>学习人数</th>
                                <th>状态</th>
                                <th>上架时间</th>
                                <if condition="$sort eq 2 || $sort eq 3">
                                    <th>开播时间</th>
                                    <th>结束时间</th>
                                </if>
                                <th>时间</th>
                                <th align="center">{:lang('ACTIONS')}</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="list" item="vo">
                                <tr>
                                    <td>
                                        <input name="list_orders[{$vo.id}]" class="layui-input" type="text" value="{$vo.list_order}">
                                    </td>
                                    <td>{$vo['id']}</td>
                                    <td>{$vo['userinfo']['user_nickname']} ({$vo['userinfo']['id']})</td>
                                    <td>{$grade[$vo['gradeid']]['name']|default=''}</td>
                                    <td>{$classs[$vo['classid']]['name']|default=''}</td>
                                    <if condition="$sort neq 1 && $sort neq 3">
                                        <td>{$types[$vo['type']]|default=''}</td>
                                    </if>
                                    <td>{$vo['name']}</td>
                                    <td><if condition="$vo['thumb']"><img src="{$vo['thumb']}"></if></td>
                                    <td>
                                        <if condition="$vo['paytype'] eq 0">
                                            免费
                                            <else/>
                                            {$paytypes[$vo['paytype']]} / {$vo['payval']}
                                        </if>
                                    </td>
                                    <if condition="$sort eq 1">
                                        <td>{$vo['lessons']}</td>
                                    </if>
                                    <td>{$vo['views']}</td>
                                    <td>{$status[$vo['status']]}</td>
                                    <td>
                                        {:date('Y-m-d H:i:s',$vo['shelvestime'])}
                                    </td>

                                    <if condition="$sort eq 2 || $sort eq 3">
                                        <td>{:date('Y-m-d H:i:s',$vo['starttime'])}</td>
                                        <td>{:date('Y-m-d H:i:s',$vo['endtime'])}</td>
                                    </if>
                                    <td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>
                                    <td>
                                        <if condition="$vo['sort'] eq 1">
                                            <a class="layui-bo layui-bo-small layui-bo-succes js-ajax-dialog-btn" href='{:url("lesson/index",array("courseid"=>$vo["id"]))}'>课时管理</a>
                                            <div class="new-divider new-divider-vertical"></div>
                                        </if>

                                        <a class="layui-bo layui-bo-small layui-bo-succes" href='{:url("coursebuy/index",array("courseid"=>$vo["id"]))}'>购买详情</a>
                                        <div class="new-divider new-divider-vertical"></div>

                                        <if condition="$vo['status'] gt 0">
                                            <a class="layui-bo layui-bo-small layui-bo-waring js-ajax-dialog-btn" href="{:url("course/setstatus",array("id"=>$vo["id"],"status"=>"-2"))}">下架</a>
                                            <else/>
                                            <a class="layui-bo layui-bo-small layui-bo-succes js-ajax-dialog-btn" href="{:url("course/setstatus",array("id"=>$vo["id"],'status'=>'1'))}">上架</a>
                                        </if>
                                        <div class="new-divider new-divider-vertical"></div>

                                        <a class="layui-bo layui-bo-small layui-bo-checked" href="{:url("course/edit",array("id"=>$vo["id"]))}">{:lang('EDIT')}</a>
                                        <div class="new-divider new-divider-vertical"></div>
                                        <a class="layui-bo layui-bo-small layui-bo-close js-ajax-delete" href="{:url('course/del',array('id'=>$vo['id']))}" <if condition="$vo['views'] gt 0">data-msg="已有{$vo['views']}人学习，确定要删除么？"</if>>{:lang('DELETE')}</a>
                                    </td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                        <div class="pagination">{$page}</div>

                    </form>
                </div>
            </div>

        </div>

	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>